# coding: utf-8
from django.contrib import admin
from store.models import *

class ClothingAdmin(admin.ModelAdmin):
    list_display = ('name','num',)
    fieldsets = (
        ('None',{'fields':('category','name','old_price',
                           'new_price','sales','num','image_url_i',
                           'image_url_c','content',)}),
    )

class CategoryAdmin(admin.ModelAdmin):
    list_display = ('id','name','parent_category',)
    list_filter = ('name','parent_category',)
    fields = ('name','parent_category',)
class CateAdmin(admin.ModelAdmin):
    search_fields = ('name',)
    list_filter = ('status','create_time')
    list_display = ('name','parent','rank','status')
    fields = ('name','parent','rank','status')

class CarouselAdmin(admin.ModelAdmin):
    search_fields = ('title',)
    list_display = ('title','img','create_time')
    list_filter = ('create_time',)
    fields = ('title','img','summary')


class ArticleAdmin(admin.ModelAdmin):
    search_fields = ('title','summary')
    list_filter = ('status','category','is_top','create_time','update_time','is_top')
    list_display = ('title','category','author','status','is_top','update_time')
    fieldsets = (
        (u'基本信息', {
            'fields': ('title','en_title','img','category','tags','author','is_top','rank','status')
            }),
        (u'内容', {
            'fields': ('content',)
            }),
        (u'摘要', {
            'fields': ('summary',)
            }),
        (u'时间', {
            'fields': ('pub_time',)
            }),
    )

class AnliAdmin(admin.ModelAdmin):

    list_filter = ('name','status','category' )
    list_display = ('name', 'status','category')
    fields = ('name', 'status','category','img','content' )
class CateanliAdmin(admin.ModelAdmin):
    list_display = ('id', 'name', 'parent_category',)
    list_filter = ('name', 'parent_category',)
    fields = ('name', 'parent_category',)
class NavAdmin(admin.ModelAdmin):
    search_fields = ('name',)
    list_display = ('name','url','status','create_time')
    list_filter = ('status','create_time')
    fields = ('name','url','status')



admin.site.register(Carousel,CarouselAdmin)
admin.site.register(Category,CategoryAdmin)
admin.site.register(Cateanli,CateanliAdmin)
admin.site.register(Clothing,ClothingAdmin)

admin.site.register(Cate,CateAdmin)
admin.site.register(Article,ArticleAdmin)
admin.site.register(Anli,AnliAdmin)
admin.site.register(Nav,NavAdmin)
